package 剑指专题.排序;


/*
 * Author：江松
 * Date：2023/3/31 20:36
 *
 数据流中的中位数:
 1，使用优先队列，左<右，左边为大根，右边为小根，维护左边大，若相等中位数是平均值，反之为左边
 2,插入排序：O(n^2)
 3，二分查找做插入
 */

import java.util.PriorityQueue;

public class Main4 {


    /*
    private PriorityQueue<Integer>left=new PriorityQueue<>((o1,o2)->o2.compareTo(o1));
    private PriorityQueue<Integer>right=new PriorityQueue<>((o1,o2)->o1.compareTo(o2));
    public void Insert(Integer num) {
        left.offer(num);
        right.offer(left.poll());
        if(left.size()<right.size()){
            left.offer(right.poll());
        }
    }
    public Double GetMedian() {
        return left.size()>right.size()?(double)left.peek():(double)(left.peek()+right.peek())/2;
    }
    */
}
